package cn.wolfcode.service.impl;

import cn.wolfcode.dao.IStudentDAO;
import cn.wolfcode.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements IStudentService {

    @Autowired
    private IStudentDAO studentDAO;

    public void setStudentDAO(IStudentDAO studentDAO) {
        this.studentDAO=studentDAO;
    }

    @Override
    public void register(String username, String password) throws Exception {
        studentDAO.save(username, password);
    }

    @Override
    public void expel(Long id) throws Exception {
        studentDAO.delete(id);
    }

    @Override
    public void updateOr(Long id, String username, String password) throws Exception {
        studentDAO.update(id,username,password);
    }

    @Override
    public void select(Long id) throws Exception {
        studentDAO.selectOne(id);
    }

    @Override
    public void select2() throws Exception {
        studentDAO.selectAll();
    }
}
